package com.ohuang.myapp.fragment.one;


import com.bumptech.glide.Glide;
import com.ohuang.baseapp.livedata.LiveData;
import com.ohuang.baseapp.livedata.Observer;
import com.ohuang.baseapp.ohRouter.OhRouter;
import com.ohuang.baseapp.utils.ToastUtils;
import com.ohuang.myapp.ResourceTable;
import com.ohuang.myapp.fragment.LogFragment;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.Image;

public class ImgFragment extends LogFragment {
    @Override
    protected int getXmlId() {
        return ResourceTable.Layout_fg_img;
    }


    Image image;
    String url="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fhiphotos.baidu.com%2Ffeed%2Fpic%2Fitem%2Ff703738da97739127b4f8440f4198618367ae2a2.jpg&refer=http%3A%2F%2Fhiphotos.baidu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1624200223&t=12826f0f74af76ca75ecc2f5ab3f740b";

    @Override
    protected void initComponent() {
        
        image = findComponentById(ResourceTable.Id_image);
        Glide.with(getContext())
                .load(ResourceTable.Media_png_fj)
                .into(image);
        image.setClickedListener(c->{
            ((AbilitySlice)getContext()).present((AbilitySlice) OhRouter.getObjectForPath("lib/test"),new Intent());;
        });

    }
}
